<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<h1 id="text">跑马灯操作的实现</h1>

<script type="text/javascript">

    function show() {
        //1.从html获取标签，利用DOM
        var tag = document.getElementById("text");
        //读取标签内容
        var text = tag.innerText;

        //2、动态起来，把文本中第一个字符串放在字符串的最后面
        var first = text[0];
        var other = text.substring(1, text.length);
        var newtext = other + first;

        //3.将新值赋给标签
        tag.innerText = newtext;
    }

    //计时器，重复执行上述函数
    setInterval(show,100);

    //setTimeout(show,1000); 间隔，只执行一次
</script>
</body>
</html>